import {dictItemUrl, getUploadConfig} from "@/config/env";
import startSearchModel from "@/config/startSearchModel";

const uploadConfig = getUploadConfig()
export default () => {
    return {
        submitText: '修改',
        size: 'default',
        labelWidth: 120,
        index: true,
        menuAlign: 'center',
        menuPosition: "right",
        align: "center",
        searchIndex: 2,
        searchMenuSpan: 6,
        searchIcon: true,
        filterBtn: true,
        editBtn: false,
        menuWidth: 300,
        permissionBtn: {
            addBtn: 'start:oss:add',
            editBtn: 'start:oss:edit',
            viewBtn: 'start:oss:info',
            delBtn: 'start:oss:delete',
        },
        column: [

            {
                "addDisplay": false,
                "editDisplay": false,
                "label": "文件id",
                "prop": "id",
                "hide": true,
                "type": "input"
            },
            {
                label: '文件',
                row: true,
                accept: "image/*",
                prop: 'ossUrl',
                type: "upload",
                width: 120,
                limit: 1,
                listType: 'picture-card',
                action: uploadConfig.action,
                propsHttp: uploadConfig.propsHttp,
                rules: [{
                    required: false,
                    trigger: "blur"
                }]
            },
            {
                "addDisplay": false,
                "editDetail": true,
                "label": "文件名称",
                "prop": "ossName",
                "showColumn": true,
                "type": "input",
                search: true,
                searchModel: startSearchModel.LIKE_RIGHT

            },
            {
                "addDisplay": false,
                "editDetail": true,
                "label": "文件类型",
                width: 120,
                hide: true,
                "prop": "ossType",
                "showColumn": true,
                "type": "input",
                search: true,
                searchModel: startSearchModel.LIKE_RIGHT
            },
            {
                "addDisplay": true,
                "editDisplay": true,
                "label": "存储器类型",
                "prop": "ossStorageType",
                "showColumn": true,
                width: 120,
                "type": "select",
                dicUrl: dictItemUrl,
                dicMethod: "get",
                dicQuery: {dictCode: "start_oss_store_type"},
                props: {
                    label: 'dictName',
                    value: 'dictVal',
                },
                control: function (val, formModel) {
                    return {
                        ossUrl: {
                            data: {
                                storageType: val
                            }
                        }
                    }
                }
            },
            {
                "addDisplay": false,
                "editDetail": true,
                "label": "本地路径",
                "prop": "ossLocalPath",
                "showColumn": true,
                "type": "input",
                hide: true,
                overHidden: true,
            },
            {
                label: 'mime类型',
                prop: 'ossMimeType',
                type: "input"

            },
            {
                "addDisplay": false,
                "editDetail": true,
                "label": "文件唯一编码",
                "prop": "ossUniqueCode",
                "hide": true,
                "type": "input"
            },
            {
                "addDisplay": false,
                "editDisplay": false,
                "label": "创建时间",
                "prop": "createTime",
                "hide": true,
                "type": "datetime"
            },
            {
                "addDisplay": false,
                "editDisplay": false,
                "label": "文件上传人",
                "prop": "createBy",
                "hide": true,
                "type": "input"
            },
            {
                "addDisplay": false,
                "editDisplay": false,
                "label": "修改时间",
                "prop": "updateTime",
                "hide": true,
                "type": "datetime"
            },
            {
                "addDisplay": false,
                "editDisplay": false,
                "label": "修改人",
                "prop": "updateBy",
                "hide": true,
                "type": "datetime"
            }
        ]

    }
}
